﻿package  
{
	
	import flash.display.MovieClip;
	import flash.events.MouseEvent;
	
	public class PetUI extends MovieClip 
	{
		public var petCount:int = 0;
		public var petArray:Array;
		
		public var px:int = 136;
		public var py:int = 160;
		
		public function PetUI() 
		{
			// constructor code
			stop();
			
			petArray = new Array();
			petArray.push( pet0 );
			petArray.push( pet1 );
			petArray.push( pet2 );
			petArray.push( pet3 );
			petArray.push( pet4 );
			
			closeButton.addEventListener( MouseEvent.CLICK , onClick );
			
					
			clear();
		}
		
		public function addPet( t:int , n:String , l:int , hp:int , maxHp:int ):void
		{
			petArray[ petCount ].setType( t );
			petArray[ petCount ].setText( n , l , hp , maxHp );
			
			petCount++;
		}
		
		public function clear():void
		{
			petCount = 0;
			
			for ( var i:int = 0 ; i < petArray.length ; i++ )
			{
				petArray[ i ].clear();
			}
		}
		
		private function onClick( e:MouseEvent )
		{
			this.visible = false;
		}
		
	}
	
}
